<?php

declare(strict_types=1);
/**
 * Author: Zane
 * Email: 873934580@qq.com
 * Date: 2023/5/29.
 */

namespace App\Http\Request\System;

use App\Models\Role;
use Illuminate\Validation\Rule;

class RoleRequest
{
    public function rules(): array
    {
        $id = (int) request()->route('id');

        return [
            'name' => ['required', 'max:255', Rule::unique(Role::class)->ignore($id)],
            'title' => ['required', 'max:255', Rule::unique(Role::class)->ignore($id)],
            'note' => 'max:200',
            'status' => 'in:0,1',
        ];
    }
}
